<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class SignupTemp extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 模板
        Schema::create('nav_temp_pack', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('temp_id')->comment('模板id');
            $table->integer('temp_parmas_id')->comment('参数id')->default(0);
            $table->string('label')->comment('中文标识');
            $table->string('name')->comment('英文标识');
            $table->integer('type_id')->comment('类型');
            $table->tinyInteger('sort')->default(0)->comment('排序');
            $table->tinyInteger('is_delete')->default(0)->comment('删除标识 1删除')->index();
            $table->timestamps();
        });
        // 类型
        Schema::create('nav_temp_type', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type')->comment('类型');
            $table->string('type_name')->comment('类型名');
            $table->string('type_default')->comment('类型默认类型');
            $table->tinyInteger('sort')->default(0)->comment('排序');
            $table->tinyInteger('is_delete')->default(0)->comment('删除标识');
            $table->timestamps();
        });
        // 组件
        Schema::create('nav_temp_subgroup', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('attribute_id')->comment('属性id');
            $table->integer('temp_pack_id')->comment('模板id');
            $table->text('value')->comment('值');
            $table->tinyInteger('is_delete')->default(0)->comment('删除标识');
            $table->timestamps();
        });

        // 属性
        Schema::create('nav_temp_attribute', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('名称');
            $table->string('value')->comment('内容');
            $table->string('item_type')->comment('属性值类型');
            $table->timestamps();
        });

        // 保存栏目模板
        Schema::create('nav_temps', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('game_id')->index();
            $table->unsignedInteger('nav_id')->index();
            $table->string('temp_name');
            $table->text('details')->comment('详情');
            $table->text('temp_selects')->comment('模板选项');
            $table->tinyInteger('rule_type')->default(2)->comment('模板选项特殊配置:1所有人，2报名成功');
            $table->dateTime('edit_start_time')->nullable()->default(NUll)->comment('开始时间');
            $table->dateTime('edit_end_time')->nullable()->default(NUll)->comment('结束时间');
            $table->tinyInteger('is_delete')->default(0)->comment('删除标识');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
